<?php
/** 
 * Created by RisingSun. 
 * User: MarkSpace 
 * Date: 20210822
 * Time: 11:05 
 * 单项管理
 */
namespace app\home\model;

use app\home\model\Model;

class Product extends Model{

    private $category = 'pro_category';
    private $product = 'pro_product';

    /**
     * 单项信息
     * @param array $procate
     * @param array $where
     */
    public function procate($where='',$file='*')
    {
        $singleinfo = Model::name($this->category)
            ->field($file)
            ->where($where)
            ->find();
        return $singleinfo;    
    }

    /**
     * 单项信息
     * @param array $productinfo
     * @param array $where
     */
    public function productinfo($where='',$file='*')
    {
        $singleinfo = Model::name($this->product)
            ->field($file)
            ->where($where)
            ->order('orderid asc')
            ->find();
        return $singleinfo;    
    }

    /**
     * 类别信息
     * @param array $procatelist
     * @param array $where
     */
    public function procatelist($where='',$file='*')
    {
        $singlelist = Model::name($this->category)
            ->field($file)
            ->where($where)
            ->limit(0,3)
            ->order('id asc')
            ->select();
        return $singlelist;    
    }

    /**
     * 类别信息
     * @param array $product
     * @param array $where
     */
    public function productlist($where='',$file='*')
    {
        $singlecate = Model::name($this->product)
            ->field($file)
            ->where($where)
            ->order('orderid asc')
            ->select();
        return $singlecate;    
    }

}
?>